package thread;

public class SynAPIDemo1 {
    public static void main(String[] args) {
        // StringBuffer sb=new StringBuffer();
        StringBuilder sb=new StringBuilder();
        Thread t1=new Thread(){
        public void run(){
            for (int i=0;i<1000;i++){
                sb.append("A");
            }
        }
    };
    Thread t2=new Thread(){
        public void run(){
            for (int i=0;i<1000;i++){
                sb.append("B");
            }
        }
    };
    t1.start();
    t2.start();
        try {
            Thread.sleep(10);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
        System.out.println(sb.length());
    }
}
